package com.yang.abstract_factory.impl;


import com.yang.abstract_factory.AbstractFactory;
import com.yang.abstract_factory.car.Car;
import com.yang.abstract_factory.car.impl.BayerischeMotorenWerke;
import com.yang.abstract_factory.car.impl.Porsche;
import com.yang.abstract_factory.car.impl.SGMW;
import com.yang.abstract_factory.paint.Paint;

public class CarFactory extends AbstractFactory {

    @Override
    public Car getCar(String name) {
        Car car;
        switch (name) {
            case "porsche":
                car = new Porsche();
                break;
            case "sgmw":
                car = new SGMW();
                break;
            case "bmw":
                car = new BayerischeMotorenWerke();
                break;
            default:
                car = () -> System.out.println("创建了一辆二手车");
                break;
        }
        return car;
    }

    @Override
    public Paint getPaint(String color) {
        return null;
    }
}
